<?php
App::uses('AppModel', 'Model');
class Category extends AppModel {
	var $name = 'Category';
	var $actsAs = array('Containable');
	var $displayField = 'title';
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $hasMany = array(
		'Article' => array(
			'className' => 'Article',
			'foreignKey' => 'category_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'Keyword' => array(
			'className' => 'Keyword',
			'foreignKey' => 'category_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);
	
	public $validate = array(
		'title' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => array('Title is required'),
			),
			'length' => array(
				'rule' => array('between', 5, 30),
				'message' => 'Title must be between 5 and 30 characters long'
			)
		),
	);
	
}
